﻿using System;
using System.Windows;
using jSLCore.Client.Presentation.BaseControl.Selection;
using Telerik.Windows.Controls;

namespace jSLCore.Client.Presentation.Wpf.TelerikSupport.Selection
{
    /// <summary>
    /// Interaction logic for ShowDetailsColumn.xaml
    /// </summary>
    internal partial class ShowDetailsColumn : GridViewColumn
    {
        public ShowDetailsColumn()
        {
            InitializeComponent();
        }

        private void goDetails_Clicked(object sender, EventArgs e)
        {
            var element = (FrameworkElement)sender;
            InvokeRowSelected(element.DataContext);
        }

        public event EventHandler<RowSelectedEventArgs> RowSelected;
        public void InvokeRowSelected(object row)
        {
            EventHandler<RowSelectedEventArgs> handler = RowSelected;
            if (handler != null) handler(this, new RowSelectedEventArgs(row));
        }
    }
}
